package hz;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by hz on 2016/12/14.
 */
public class JavaMain {
    public static void main(String[] args) throws SQLException {
        RuleBean ruleBean=null;
        List<RuleBean> list=new ArrayList<>();
        Connection con = DBUtil.getPoorConnection();
        String sql="SELECT id,timerange,number,samepol,diffpol FROM rule WHERE onoff=\"启用\"";
        PreparedStatement pre = con.prepareStatement(sql);
        ResultSet rs = pre.executeQuery();
        while (rs.next()){
            ruleBean=new RuleBean();
            int id=rs.getInt("id");
            ruleBean.setId(id);
            ruleBean.setTimerange(rs.getInt("timerange"));
            ruleBean.setNumber(rs.getInt("number"));
            ruleBean.setSamepol(rs.getString("samepol"));
            ruleBean.setDiffpol(rs.getString("diffpol"));
            ruleBean.setTiaojian(DBUtil.gettiaojiao(id));
            System.out.println(ruleBean);
            list.add(ruleBean);
        }


    }
}
